#!/usr/bin/python
# -*- coding: UTF-8 -*-
from bs4 import BeautifulSoup
import requests
import json
from common import cookies
import unittest
import queue
import time
import sys,os
import configparser as cparser

"""
pyinstaller 打包方法
到py文件所在路径，cmd中输入：pyinstaller -F FaBiao.py  
则自动进行打包，并生成几个文件夹，其中dist为可运行exe文件
运行时最好在cmd中启动，因为可以显示log和error，cmd命令：FaBiao.py 则执行
"""


#-------- python中获取打包成执行文件(exe)和脚本运行文件的路径
config_name = 'config.ini'
# determine if application is a script file or frozen exe
if getattr(sys, 'frozen', False):
    application_path = os.path.dirname(sys.executable)
elif __file__:
    application_path = os.path.dirname(__file__)
config_path = os.path.join(application_path, config_name)
print(config_path)

cf = cparser.ConfigParser()
cf.read(config_path)

# --------拼cookie
cookie = cf.get("conf","cookie")
cookies = {}
for line in cookie.split(';'):
    name,value=line.strip().split('=',1)
    cookies[name]=value

# --------把cookie加到session里
cookies = requests.utils.cookiejar_from_dict(cookies, cookiejar=None, overwrite=True)
session = requests.Session()
session.cookies = cookies

# --------获取借款标号和排序号的值
url_getInfo = "https://jct.9caitong.com/m3389.php?m=Deal&a=add"
html_doc = session.get(url_getInfo, verify=False)
# soup = BeautifulSoup(html_doc, 'html.parser')
# print(html_doc.text)
soup = BeautifulSoup(html_doc.text)
# # 格式化输出
# print(soup.prettify())
deal_sn_input = soup.find('input', attrs={"name": "deal_sn"})
# print(deal_sn_input.prettify())
# print(deal_sn_input["value"])
sort_input = soup.find('input', attrs={"name": "sort"})
# print(sort_input.prettify())
try:
    print(sort_input["value"])
except TypeError as err:
    print("------------"+"请重新获取cookie信息，cookie信息已失效!  ",err)

# --------获取文件中的信息
name_get = cf.get("conf","name")
sub_name_get = cf.get("conf","sub_name")
user_name_get = cf.get("conf","user_name")
user_id_get = cf.get("conf","user_id")
borrow_amount_get = cf.get("conf","borrow_amount")
min_loan_money_get = cf.get("conf","min_loan_money")
max_loan_money_get = cf.get("conf","max_loan_money")
repay_time_get = cf.get("conf","repay_time")
rate_get = cf.get("conf","rate")
enddate_get = cf.get("conf","enddate")
use_ecv_get = cf.get("conf","use_ecv")
use_interestrate_get = cf.get("conf","use_interestrate")
cunguan_tag_get = cf.get("conf","cunguan_tag")
mortgage_brand_get = cf.get("conf","mortgage_brand")
mortgage_year_get = cf.get("conf","mortgage_year")
mortgage_info_get = cf.get("conf","mortgage_info")
mortgage_insurance_get = cf.get("conf","mortgage_insurance")
interest_rate_get = cf.get("conf","interest_rate")
deal_sn_get = cf.get("conf","deal_sn")
is_advance_get = cf.get("conf","is_advance")
start_time_get = cf.get("conf","start_time")

# 判断是否为预售标
time1 = time.strftime('%Y-%m-%d',time.localtime(time.time()))
time2 = time.strftime('%H:%M:%S',time.localtime(time.time()))
is_advance = is_advance_get
is_advance_int = int(is_advance)
start_time = ""
if is_advance_int == 1:
    start_time = start_time_get
else:
    start_time = time1 + time2

print("------------" + start_time)

# 如遇借款编号重复，替换为手动输入的借款编号
deal_sn = ""
if deal_sn_get == "使用默认编号" :
    deal_sn = deal_sn_input["value"]
else:
    deal_sn = deal_sn_get
print("-----------"+ deal_sn)


# --------给标的各字段赋值
name = name_get
sub_name = sub_name_get
user_name = user_name_get
user_id = user_id_get
borrow_amount = borrow_amount_get
min_loan_money = min_loan_money_get
max_loan_money = max_loan_money_get
repay_time = repay_time_get
rate = rate_get
enddate = enddate_get
use_ecv = use_ecv_get
use_interestrate = use_interestrate_get
cunguan_tag = cunguan_tag_get
mortgage_brand = mortgage_brand_get
mortgage_year = mortgage_year_get
mortgage_info = mortgage_info_get
mortgage_insurance = mortgage_insurance_get
interest_rate = interest_rate_get
sort = sort_input["value"]
Build_id = ""
Build_title = ""
Build_status = ""
addContent = ""

class ReleaseTarget(unittest.TestCase):

    """
    新建标的
    修改：deal_sn，name，sub_name，sort
    """
    def addTarget(self):
        url = "https://jct.9caitong.com/m3389.php"
        files ={
        "deal_sn":(None,deal_sn),
        "name":(None,name),
        "sub_name":(None,sub_name),
        "user_name":(None,user_name),
        "user_id":(None,user_id),
        "city_id[]":(None,"1"),
        "cate_id":(None,"7"),
        "guarantor_margin_amt":(None,"0.00"),
        "guarantor_amt":(None,"0.00"),
        "guarantor_pro_fit_amt":(None,"0.00"),
        "type_id":(None,"11"),
        "loantype":(None,"1"),
        "contract_id":(None,"3"),
        "tcontract_id":(None,"3"),
        "borrow_amount":(None,borrow_amount),
        "guarantees_amt":(None,"0.00"),
        "uloadtype":(None,"0"),
        "min_loan_money":(None,min_loan_money),
        "max_loan_money":(None,max_loan_money),
        "portion":(None,"0"),
        "max_portion":(None,"0"),
        "repay_time":(None,repay_time),
        "repay_time_type":(None,"1"),
        "rate":(None,rate),
        "enddate":(None,enddate),
        "use_ecv":(None,use_ecv),
        "use_interestrate":(None,use_interestrate),
        "cunguan_tag":(None,cunguan_tag),
        "description":(None,""),
        "risk_rank":(None,"0"),
        "risk_security":(None,""),
        "sort":(None,sort),
        "services_fee":(None,""),
        "score":(None,"0"),
        "manage_fee":(None,"0"),
        "user_loan_manage_fee":(None,"0"),
        "user_loan_interest_manage_fee":(None,"0"),
        "manage_impose_fee_day1":(None,"0"),
        "manage_impose_fee_day2":(None,"0"),
        "impose_fee_day1":(None,"0.05"),
        "impose_fee_day2":(None,"0"),
        "user_load_transfer_fee":(None,"0"),
        "transfer_day":(None,"0"),
        "compensate_fee":(None,"0"),
        "user_bid_rebate":(None,"0"),
        "user_bid_score_fee":(None,"0"),
        "generation_position":(None,"100"),
        "attachment":(None,""),
        "tattachment":(None,""),
        "seo_title":(None,""),
        "seo_keyword":(None,""),
        "seo_description":(None,""),
        "mortgage_type":(None,"车辆"),
        "mortgage_brand":(None,mortgage_brand),
        "mortgage_color":(None,"灰色"),
        "mortgage_year":(None,mortgage_year),
        "mortgage_info":(None,mortgage_info),
        "mortgage_insurance":(None,mortgage_insurance),
        "mortgage_contract_name_1":(None,""),
        "mortgage_contract_img_1":(None,""),
        "mortgage_contract_name_2":(None,""),
        "mortgage_contract_img_2":(None,""),
        "mortgage_contract_name_3":(None,""),
        "mortgage_contract_img_3":(None,""),
        "mortgage_contract_name_4":(None,""),
        "mortgage_contract_img_4":(None,""),
        "mortgage_infos_name_1":(None,""),
        "mortgage_infos_img_1":(None,""),
        "mortgage_infos_name_2":(None,""),
        "mortgage_infos_img_2":(None,""),
        "mortgage_infos_name_3":(None,""),
        "mortgage_infos_img_3":(None,""),
        "mortgage_infos_name_4":(None,""),
        "mortgage_infos_img_4":(None,""),
        "mortgage_infos_name_5":(None,""),
        "mortgage_infos_img_5":(None,""),
        "mortgage_infos_name_6":(None,""),
        "mortgage_infos_img_6":(None,""),
        "m":(None,"Deal"),
        "a":(None,"insert"),
        }
        r = session.post(url,files=files,verify=False)
        print(r.text) # 获取响应报文
        # print(r.headers)


        soup = BeautifulSoup(r.text)
        # # 格式化输出
        print(soup)
        # deal_sn_input = soup.find('input', attrs={"name": "deal_sn"})
        # print(deal_sn_input.prettify())
        # print(deal_sn_input["value"])
        sort_title = soup.find('th', attrs={"class": "title_row"})
        sort_tr = soup.find('td', attrs={"class": "message_row"})
        # sort_faild = soup.find('td', attrs={"class": "jump_row"})
        # print(sort_input.prettify())
        # print(sort_tr)
        # print(sort_tr)
        # print(sort_tr[1].children)
        # print(sort_tr.string)
        self.addTitle = sort_title.string
        self.addContent = sort_tr.string
        # print(self.addContent)


    def getID(self):
        # 获取标的id
        url = "https://jct.9caitong.com/m3389.php?name=&user_name=&borrow_amount=&rate=&repay_time=&repay_time_type=0&work_id=&id=&loantype=-1&cate_id=0&type_id=0&city_id=0&is_cunguan=1&deal_status=all&is_has_received=all&m=Deal&a=index"
        html_doc = session.get(url, verify=False)
        # soup = BeautifulSoup(html_doc, 'html.parser')
        # print(html_doc.text)
        soup = BeautifulSoup(html_doc.text)
        # 格式化输出
        # print(soup.prettify())
        tr = soup.find('tr', attrs={"class": "row "})
        # print(tr.prettify())
        tds = tr.find_all('td')
        # .string 和 get_text都可以获取到文本内容
        Build_title = tds[2].find("a").string
        Build_id = tds[1].get_text().replace(u'\xa0', u'')
        Build_status = tds[10].get_text().replace(u'\xa0', u'')
        print(Build_title)
        print(Build_id)
        return Build_title,Build_id,Build_status

    def examine1_control(self):

        self.Build_title, self.Build_id,self.Build_status = ReleaseTarget.getID(self)
        # if  self.Build_status == "等材料":
        #     print("----------------------")
        #     print(self.Build_status)
        # print(self.addTitle,self.addContent+"a")
        if self.addTitle == "操作成功！" and  self.addContent == "添加成功":
            print("-------添加成功")
            ReleaseTarget.examine1_run(self)
        elif self.Build_title == sub_name and self.Build_status == "无效":
            print("---无效")
            ReleaseTarget.examine1_run(self)
        else:
            print("----------------新增标的失败： " + self.addTitle + "  " + self.addContent)
            # print("----------------新增标的失败： " +  self.addContent)
            # print(self.addTitle)
            print("----------------跳过初审1")



    def examine1_run(self):
        """
        初审1
        修改：deal_sn，name，sub_name，sort， id
        """
        # Build_id2 = ReleaseTarget.getID(self)

        url = "https://jct.9caitong.com/m3389.php"
        # self.Build_title, self.Build_id = ReleaseTarget.getID(self)
        # if self.Build_title == sub_name:
        #     print("---1")
        # else:
        #     print("-----2")
        #     print(self.Build_title)
        #     print(sub_name)

        files = {
            "deal_sn": (None, deal_sn),
            "name": (None, name),
            "sub_name": (None, sub_name),
            "user_id": (None, user_id),
            "city_id[]": (None, "1"),
            "cate_id": (None, "7"),
            "guarantor_margin_amt": (None, "0.00"),
            "guarantor_amt": (None, "0.00"),
            "guarantor_pro_fit_amt": (None, "0.00"),
            "icon": (None, ""),
            "type_id": (None, "11"),
            "loantype": (None, "1"),
            "contract_id": (None, "3"),
            "tcontract_id": (None, "3"),
            "borrow_amount": (None, borrow_amount),
            "guarantees_amt": (None, "0.00"),
            "uloadtype": (None, "0"),
            "min_loan_money": (None, min_loan_money),
            "max_loan_money": (None, max_loan_money),
            "portion": (None, "0"),
            "max_portion": (None, "0"),
            "repay_time": (None, repay_time),
            "repay_time_type": (None, "1"),
            "rate": (None, rate),
            "enddate": (None, enddate),
            "use_ecv": (None, use_ecv),
            "use_interestrate": (None, use_interestrate),
            "cunguan_tag": (None, cunguan_tag),
            "description": (None, ""),
            "risk_rank": (None, "0"),
            "risk_security": (None, ""),
            "loans_pic": (None, ""),
            "publish_wait": (None, "1"),
            "sort": (None, sort),
            "services_fee": (None, "5"),
            "score": (None, "0"),
            "manage_fee": (None, "0.3"),
            "user_loan_manage_fee": (None, "0"),
            "user_loan_interest_manage_fee": (None, "0"),
            "manage_impose_fee_day1": (None, "0"),
            "manage_impose_fee_day2": (None, "0"),
            "impose_fee_day1": (None, "0.05"),
            "impose_fee_day2": (None, "0"),
            "user_load_transfer_fee": (None, "0"),
            "transfer_day": (None, "0"),
            "compensate_fee": (None, "0"),
            "user_bid_rebate": (None, "0"),
            "user_bid_score_fee": (None, "0"),
            "generation_position": (None, "100.00"),
            "attachment": (None, ""),
            "tattachment": (None, ""),
            "seo_title": (None, ""),
            "seo_keyword": (None, ""),
            "seo_description": (None, ""),
            "mortgage_type": (None, "车辆"),
            "mortgage_brand": (None, mortgage_brand),
            "mortgage_color": (None, "灰色"),
            "mortgage_year": (None, mortgage_year),
            "mortgage_info": (None, mortgage_info),
            "mortgage_insurance": (None, mortgage_insurance),
            "mortgage_infos_name_1": (None, ""),
            "mortgage_infos_img_1": (None, ""),
            "mortgage_infos_name_2": (None, ""),
            "mortgage_infos_img_2": (None, ""),
            "mortgage_infos_name_3": (None, ""),
            "mortgage_infos_img_3": (None, ""),
            "mortgage_infos_name_4": (None, ""),
            "mortgage_infos_img_4": (None, ""),
            "mortgage_infos_name_5": (None, ""),
            "mortgage_infos_img_5": (None, ""),
            "mortgage_infos_name_6": (None, ""),
            "mortgage_infos_img_6": (None, ""),
            "id": (None,self.Build_id),
            "old_next_repay_time": (None, "0"),
            "m": (None, "Deal"),
            "a": (None, "update")
        }
        r = session.post(url, files=files, verify=False)
        print(r.text)  # 获取响应报文
        # print(r.headers)
        # print(files)


    def examine2_control(self):

        #初审1成功后，查看标的id是否显示在初审2页面
        url = "https://jct.9caitong.com/m3389.php?m=Deal&a=publish&"
        r = session.get(url, verify=False)
        # # print(r.text)
        #
        soup = BeautifulSoup(r.text)
        # # print(soup.prettify())
        input = soup.find('input', attrs={"name": "key"})
        Build_id = input["value"]
        print(Build_id)
        #

        print(self.Build_id)
        # print(self.addContent)

        # if self.addTitle == "操作成功！" and  self.addContent == "添加成功" and Build_id == self.Build_id:
        if Build_id == self.Build_id:
            print("-------添加成功")
            ReleaseTarget.examine2_run(self)
        else:
            print("----------------跳过初审2")

    def examine2_run(self):
        """
        初审2
        修改：deal_sn，name，sub_name，sort，id，start_time
        """

        url = "https://jct.9caitong.com/m3389.php"
        files = {
            "deal_sn": (None, deal_sn),
            "name": (None, name),
            "sub_name": (None, sub_name),
            "user_id": (None, user_id),
            "city_id[]": (None, "1"),
            "cate_id": (None, "7"),
            "guarantor_margin_amt": (None, "0.00"),
            "guarantor_amt": (None, "0.00"),
            "guarantor_pro_fit_amt": (None, "0.00"),
            "icon": (None, ""),
            "type_id": (None, "11"),
            "loantype": (None, "1"),
            "contract_id": (None, "3"),
            "tcontract_id": (None, "3"),
            "borrow_amount": (None, borrow_amount),
            "guarantees_amt": (None, "0.00"),
            "uloadtype": (None, "0"),
            "min_loan_money": (None, min_loan_money),
            "max_loan_money": (None, max_loan_money),
            "portion": (None, "0"),
            "max_portion": (None, "0"),
            "repay_time": (None, repay_time),
            "repay_time_type": (None, "1"),
            "rate": (None, rate),
            "enddate": (None, enddate),
            "use_ecv": (None, use_ecv),
            "use_interestrate": (None, use_interestrate),
            "cunguan_tag": (None, cunguan_tag),
            "description": (None, ""),
            "risk_rank": (None, "0"),
            "risk_security": (None, ""),
            "sort": (None, sort),
            "services_fee": (None, "5"),
            "score": (None, "0"),
            "manage_fee": (None, "0.3"),
            "user_loan_manage_fee": (None, "0"),
            "user_loan_interest_manage_fee": (None, "0"),
            "manage_impose_fee_day1": (None, "0"),
            "manage_impose_fee_day2": (None, "0"),
            "impose_fee_day1": (None, "0.05"),
            "impose_fee_day2": (None, "0"),
            "user_load_transfer_fee": (None, "0"),
            "transfer_day": (None, "0"),
            "compensate_fee": (None, "0"),
            "user_bid_rebate": (None, "0"),
            "user_bid_score_fee": (None, "0"),
            "generation_position": (None, "100.00"),
            "attachment": (None, ""),
            "tattachment": (None, ""),
            "seo_title": (None, ""),
            "seo_keyword": (None, ""),
            "seo_description": (None, ""),
            "is_mortgage": (None, "0"),
            "mortgage_fee": (None, "0"),
            "mortgage_desc": (None, ""),
            "is_advance": (None, is_advance),
            "deal_status": (None, "1"),
            "delete_msg": (None, ""),
            "start_time": (None, start_time),
            "id": (None, self.Build_id),
            "old_next_repay_time": (None, "0"),
            "m": (None, "Deal"),
            "a": (None, "publish_update"),
        }

        r = session.post(url, files=files, verify=False)
        # r = session.post(url,data=data,verify=False)
        print(r.text)  # 获取响应报文
        # print(r.headers)
        # print(files)

    def examine3_control(self):
        # 初审2成功后，查看标的id是否显示在复审页面
        url = "https://jct.9caitong.com/m3389.php?m=Deal&a=true_publish&"
        r = session.get(url, verify=False)
        # # print(r.text)
        #
        soup = BeautifulSoup(r.text)
        # # print(soup.prettify())
        input = soup.find('input', attrs={"name": "key"})
        Build_id = input["value"]
        print(Build_id)
        #

        print(self.Build_id)
        # print(self.addContent)
        #判断
        if  Build_id == self.Build_id:
            print("-------添加成功")
            ReleaseTarget.examine3_run(self)
        else:
            print("----------------跳过复审")


    def examine3_run(self):
        """
        复审标的
        修改：deal_sn，name，sub_name，sort，id
        """
        if self.addContent != "添加成功":
            print("----------------跳过复审")
        else:
            url = "https://jct.9caitong.com/m3389.php"

            files = {
                "deal_sn": (None, deal_sn),
                "name": (None, name),
                "sub_name": (None, sub_name),
                "user_id": (None, user_id),
                "city_id[]": (None, "1"),
                "cate_id": (None, "7"),
                "guarantor_margin_amt": (None, "0.00"),
                "guarantor_amt": (None, "0.00"),
                "guarantor_pro_fit_amt": (None, "0.00"),
                "icon": (None, ""),
                "type_id": (None, "11"),
                "loantype": (None, "1"),
                "contract_id": (None, "3"),
                "tcontract_id": (None, "3"),
                "borrow_amount": (None, borrow_amount),
                "guarantees_amt": (None, "0.00"),
                "uloadtype": (None, "0"),
                "min_loan_money": (None, min_loan_money),
                "max_loan_money": (None, max_loan_money),
                "portion": (None, "0"),
                "max_portion": (None, "0"),
                "repay_time": (None, repay_time),
                "repay_time_type": (None, "1"),
                "rate": (None, rate),
                "enddate": (None, enddate),
                "use_ecv": (None, use_ecv),
                "use_interestrate": (None, use_interestrate),
                "cunguan_tag": (None, cunguan_tag),
                "description": (None, ""),
                "risk_rank": (None, "0"),
                "risk_security": (None, ""),
                "sort": (None, sort),
                "services_fee": (None, "5"),
                "score": (None, "0"),
                "manage_fee": (None, "0.3"),
                "user_loan_manage_fee": (None, "0"),
                "user_loan_interest_manage_fee": (None, "0"),
                "manage_impose_fee_day1": (None, "0"),
                "manage_impose_fee_day2": (None, "0"),
                "impose_fee_day1": (None, "0.05"),
                "impose_fee_day2": (None, "0"),
                "user_load_transfer_fee": (None, "0"),
                "transfer_day": (None, "0"),
                "compensate_fee": (None, "0"),
                "user_bid_rebate": (None, "0"),
                "user_bid_score_fee": (None, "0"),
                "generation_position": (None, "100.00"),
                "attachment": (None, ""),
                "tattachment": (None, ""),
                "seo_title": (None, ""),
                "seo_keyword": (None, ""),
                "seo_description": (None, ""),
                "is_mortgage": (None, "0"),
                "mortgage_fee": (None, "0"),
                "mortgage_desc": (None, ""),
                "publish": (None, "4"),
                "publish_msg": (None, ""),
                "id": (None, self.Build_id),
                "old_next_repay_time": (None, "0"),
                "m": (None, "Deal"),
                "a": (None, "true_publish_update"),

            }

            r = session.post(url, files=files, verify=False)
            # r = session.post(url,data=data,verify=False)
            print(r.text)  # 获取响应报文
            # print(r.headers)

    def examine4_control(self):
        # 复审成功后，查看标的id是否显示在终审页面
        url = "https://jct.9caitong.com/m3389.php?m=Deal&a=four_check&"
        r = session.get(url, verify=False)
        # # print(r.text)
        #
        soup = BeautifulSoup(r.text)
        # # print(soup.prettify())
        input = soup.find('input', attrs={"name": "key"})
        Build_id = input["value"]
        print(Build_id)
        #

        print(self.Build_id)
        # print(self.addContent)
        # 判断
        if  Build_id == self.Build_id:
            print("-------添加成功")
            ReleaseTarget.examine4_run(self)
        else:
            print("----------------跳过终审")

    def examine4_run(self):
        """
        终审标的
        修改：deal_sn，name，sub_name，sort，id
        """
        if self.addContent != "添加成功":
            print("----------------跳过终审")
        else:
            url = "https://jct.9caitong.com/m3389.php"
            files = {
                "deal_sn": (None, deal_sn),
                "name": (None, name),
                "sub_name": (None, sub_name),
                "user_id": (None, user_id),
                "city_id[]": (None, "1"),
                "cate_id": (None, "7"),
                "guarantor_margin_amt": (None, "0.00"),
                "guarantor_amt": (None, "0.00"),
                "guarantor_pro_fit_amt": (None, "0.00"),
                "icon": (None, ""),
                "type_id": (None, "11"),
                "loantype": (None, "1"),
                "contract_id": (None, "3"),
                "tcontract_id": (None, "3"),
                "borrow_amount": (None, borrow_amount),
                "guarantees_amt": (None, "0.00"),
                "uloadtype": (None, "0"),
                "min_loan_money": (None, min_loan_money),
                "max_loan_money": (None, max_loan_money),
                "portion": (None, "0"),
                "max_portion": (None, "0"),
                "repay_time": (None, repay_time),
                "repay_time_type": (None, "1"),
                "rate": (None, rate),
                "interest_rate": (None, interest_rate),
                "enddate": (None, enddate),
                "use_ecv": (None, use_ecv),
                "use_interestrate": (None, use_interestrate),
                "cunguan_tag": (None, cunguan_tag),
                "description": (None, ""),
                "risk_rank": (None, "0"),
                "risk_security": (None, ""),
                "sort": (None, sort),
                "services_fee": (None, "5"),
                "score": (None, "0"),
                "manage_fee": (None, "0.3"),
                "user_loan_manage_fee": (None, "0"),
                "user_loan_interest_manage_fee": (None, "0"),
                "manage_impose_fee_day1": (None, "0"),
                "manage_impose_fee_day2": (None, "0"),
                "impose_fee_day1": (None, "0.05"),
                "impose_fee_day2": (None, "0"),
                "user_load_transfer_fee": (None, "0"),
                "transfer_day": (None, "0"),
                "compensate_fee": (None, "0"),
                "user_bid_rebate": (None, "0"),
                "user_bid_score_fee": (None, "0"),
                "generation_position": (None, "100.00"),
                "attachment": (None, ""),
                "tattachment": (None, ""),
                "seo_title": (None, ""),
                "seo_keyword": (None, ""),
                "seo_description": (None, ""),
                "is_mortgage": (None, "0"),
                "mortgage_fee": (None, "0"),
                "mortgage_desc": (None, ""),
                "publish": (None, "0"),
                "publish_msg": (None, ""),
                "id": (None, self.Build_id),
                "old_next_repay_time": (None, "0"),
                "m": (None, "Deal"),
                "a": (None, "true_publish_update4"),
            }

            r = session.post(url, files=files, verify=False)
            # r = session.post(url,data=data,verify=False)
            print(r.text)  # 获取响应报文
            # print(r.headers)
            url2 = "https://jct.9caitong.com/m3389.php?m=Deal&a=set_effect&id="+self.Build_id+"&ajax=1"
            session.get(url2,verify=False)
            # print(url2)
            print("----------------发标完成，并完成四步审核!")
            print("----------------新发布的标的已展示在前端页面，请查看！")


if __name__ == '__main__':
    test = ReleaseTarget()
    test.addTarget()
    test.examine1_control()
    test.examine2_control()
    test.examine3_control()
    test.examine4_control()

